package com.project.managementpaltform.mapper;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

@Mapper
public interface PersonnelMapper {

    /**
     * 根据参与人员去查参与项目
     * @param Personnel 参与人员
     * */
    @Select("SELECT Project leader FROM personnel WHERE Personnel = #{Personnel} AND ROWNUM=1")
    String queryProjectByPersonnel(@Param("Personnel") String Personnel);

    /**
     * 根据参与项目去查参与人员
     * @param Project 参与项目
     * */
    @Select("SELECT Personnel  FROM personnel WHERE Project = #{Project} AND ROWNUM=1")
    String queryPersonnelByProject(@Param("Project") String Project);

    /**
     * 插入新的项目参与关系
     *
     * */
    @Insert("INERT INTO personnel (Personnel,Project)" +
            " VALUES(#{Personnel},#{Project})")
    int insertPersonnel(@Param("Personnel") String Personnel,
                      @Param("Project") String Project);

}
